package com.ruoyi.cmdb.controller;

import com.ruoyi.cmdb.util.Ip;
import com.ruoyi.cmdb.util.Port;
import com.ruoyi.cmdb.vo.IpNetwork;
import com.ruoyi.cmdb.vo.PortInfo;
import com.ruoyi.cmdb.vo.ScanIpAutoReq;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * testPort
 */
@RestController
@RequestMapping("/cmdb/testPort")
@Api(tags = "7.testPort")
public class TestPortController {
    /**
     * testPort
     */
    @SneakyThrows
    @PostMapping("/testPort")
    @ApiOperation("1.testPort")
    public AjaxResult scanAuto(Integer testPort)  {
        Port port=new Port();
        //port.run();
        List <PortInfo> portInfos=port.scanPortByIp("192.168.32.146");
        System.out.println(portInfos.toString());
        String rps="port success sout";
        System.out.println(rps);
        return AjaxResult.success(rps);
    }
}
